
from logicExistJudge import isExist
from updateCanAppfnc import update_precopy_function
import json

def main():
    
    # 示例信号数据
    signal_data = '''
    {
        "mmi": {
            "name": "XXX",
            "frameCount": 3,
            "defaultValue": "0x0"
        },
        "no_mmi": {
            "name": "YYY",
             "upMessageName": "PTG_Status_Info"
        }
    }
    '''

    # 示例代码路径
    base_path = r"C:\Users\mcu\Desktop\svn-molead-mcu\resource\20250319-code\Reset\Source\APP"

    # 判断信号实现是否已经存在
    # isLogicExist = isExist(signal_data, base_path)

    data = json.loads(signal_data)
    up_signal_name = data["no_mmi"]["name"]
    up_message_name = data["no_mmi"]["upMessageName"]
    status, message = update_precopy_function(base_path, up_signal_name, up_message_name)
    print(message)

if __name__ == "__main__":
    main()
